define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params) {
	
	$scope.form.fk_organization = params.fk_organization;
	$scope.form.fk_unit='self';
   //查询教职工数据
	$scope.find = function(){
		httpService.postpage(app.urls.teacher_selectNotExitOrg,$scope.form,function(data){		
			if("0000" === data.code){
    			$scope.rows = data.data;
    		}else{
    			alert(data.msg);
    		}
		});
	}
	$scope.find();
	//按钮点击事件-条件查询
	$scope.select = function(){
    	$scope.page.current = 1;
    	$scope.find();
    }
	$scope.saveForm = function(){
		var values = [];
		$('#'+$scope.controllerName+' input[name="dataPk"]:checked').each(function(){ 
			values.push($(this).val());
		});
		if($scope.formCheck()){
			if(values.length < 1){
				eventBusService.publish('modal.alert', {"title":"操作提示","content":"请选择添加数据。"});
			}else{
				$scope.form.users = JSON.stringify(values);
				httpService.post(app.urls.organization_insertUserOrganization,$scope.form,function(data){
					if("0000" === data.code){
						var data = {id:params.fk_organization,type:params.type};
						eventBusService.publish("content.page.reload",data);
						eventBusService.publish("modal.page.close",{});
					}else{
						alert(data.msg);
					}
				});
			}
		}
	}
	
	
}}});